////HEADS///////////////////////////////////////////////////////////////////
//
//  Melify Internet Toolkit (MTK) - Copyright (C) 2015  Melify LLC.
//  
//  This program is free software: you can redistribute it and//or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  any later version.
//  
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//  
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see http://www.gnu.org/licenses.
//
////HEADE/////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////
////
////////////////////////////////////////////////////////////
function getInternetExplorerVersion() {
    // Returns the version of Internet Explorer or a -1
    // (indicating the use of another browser).
    
    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
	var ua = navigator.userAgent;
	var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
	if (re.exec(ua) != null)
	    rv = parseFloat( RegExp.$1 );
    }

    return rv;
}

////////////////////////////////////////////////////////////
////
////////////////////////////////////////////////////////////
function checkVersionKEEP() {
    var ver = getInternetExplorerVersion();

    if (ver == -1) {
	return;
    }

    if ( ver < 8 ) {
	document.location.href="/mtk/render?page=noie";
	return true;
    }

    if ( ver >= 8 ) {
	loadjscssfile("http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js","js");

	// DEFINE CONSOLE IF NONE EXIST
	if (!console) console = {log: function() {}};

	// FIREBUG LITE DEBUGGER
	loadjscssfile("https://getfirebug.com/firebug-lite.js","js");
    }
}

////////////////////////////////////////////////////////////
////
////////////////////////////////////////////////////////////
function checkVersion() {
    var ver = getInternetExplorerVersion();

    if ( ver > -1 ) {
	document.location.href="/mtk/render?page=noie";
    }
}

checkVersion();
